import { Toast } from "@taroify/core"
import { useToastStore, hideToast } from './store'

export default function BtToast () {
  const isOpened = useToastStore(state => state.isOpened)
  const text = useToastStore(state => state.text)
  const icon = useToastStore(state => state.icon)

  const close = () => {
    hideToast()
  }
  return (
    <Toast open={isOpened} icon={icon} onClose={close}>{ text }</Toast>
  )
}
